<?php
$name = $_FILES['add_img']['name'];
$rand = rand(100,999);
$real_name = $rand.$name;
$target = "files/".$rand.$name;

if(move_uploaded_file($_FILES['add_img']['tmp_name'],$target)){
$arr['name']=$real_name;
$arr['path']=$target;
}
echo json_encode($arr);
?>